< previous page page_398 next page >

Page 398
From here, you should be able to pass the employee type to the Employee form and have it just select those employees that match the type. Heres the code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdEmployee_Click()
   With frmEmployee
      .EmpTypeID = CLng(Val(Trim$(txtTypeID)))
      .Show
   End With
End Sub
In this code, you can see that a property called EmpTypeID is being set on the Employee form prior to displaying the form. Setting the properties on the Employee form does not load the form. When the Show method is invoked, this property will already be set with the data from the txtTypeID text box on the Employee Types form.
9f31265bb40b592b1929e18a47ab28e5.gif
TIP
Use property procedures within forms to pass data from one form to another.
Property Procedures in the Employee Form
In the Employee form, a Property Let procedure is created to allow any form or routine to set EmpTypeID prior to calling the Employee form:
9f31265bb40b592b1929e18a47ab28e5.gif
Private mlngEmpTypeID As Long

Property Get EmpTypeID() As Long
   EmpTypeID = mlngEmpTypeID
End Property

Property Let EmpTypeID(ByVal lngValue As Long)
   mlngEmpTypeID = lngValue
End Property
These two property procedures hide the actual data value stored in the class. You can use this Private data value anywhere within the Employee form. Other forms must use the Public interface routines defined using the Property Get/Let procedures.

 
< previous page page_398 next page >

If you like this book, buy it!